home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2017 October / PCgo 10-2017 CD-ROM Germany.iso / nw.pak / Unnamed File 004921.txt < prev    next >
Encoding:
Text File  |  2015-07-29  |  1.5 KB  |  43 lines

  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4.  
  5. // This module implements experimental API for <webview>.
  6. // See web_view.js for details.
  7. //
  8. // <webview> Experimental API is only available on canary and dev channels of
  9. // Chrome.
  10.  
  11. var WebViewImpl = require('webView').WebViewImpl;
  12. var WebViewInternal = require('webViewInternal').WebViewInternal;
  13.  
  14. // Loads a data URL with a specified base URL used for relative links.
  15. // Optionally, a virtual URL can be provided to be shown to the user instead
  16. // of the data URL.
  17. WebViewImpl.prototype.loadDataWithBaseUrl = function(
  18.     dataUrl, baseUrl, virtualUrl) {
  19.   if (!this.guest.getId()) {
  20.     return;
  21.   }
  22.   WebViewInternal.loadDataWithBaseUrl(
  23.       this.guest.getId(), dataUrl, baseUrl, virtualUrl, function() {
  24.         // Report any errors.
  25.         if (chrome.runtime.lastError != undefined) {
  26.           window.console.error(
  27.               'Error while running webview.loadDataWithBaseUrl: ' +
  28.                   chrome.runtime.lastError.message);
  29.         }
  30.       });
  31. };
  32.  
  33. // An array of <webview>'s experimental API methods. See |WEB_VIEW_API_METHODS|
  34. // in web_view_api_methods.js for more details.
  35. var WEB_VIEW_EXPERIMENTAL_API_METHODS = [
  36.   'loadDataWithBaseUrl'
  37. ];
  38.  
  39. // Registers the experimantal WebVIew API when available.
  40. WebViewImpl.maybeGetExperimentalApiMethods = function() {
  41.   return WEB_VIEW_EXPERIMENTAL_API_METHODS;
  42. };
  43.